package com.liangzhong.model.login
{
	import com.liangzhong.model.AppData;
	
	import flash.events.EventDispatcher;

	/**
	 *签到信息 
	 * @author lake
	 * 
	 */	
	public class SignInfoVo extends EventDispatcher
	{
		/**
		 * 今天是否签到
		 */		
		public var is_sign 			:int;
		/**
		 * 今天是否领取
		 */		
		public var is_get_today 	:int;
		/**
		 * 连续签到天数
		 */		
		public var continue_sign 	:int;
		/**
		 * 本月签到天数
		 */		
		public var sign_days		:int;
		/**
		 *已经补签天数 
		 */		
		public var reSignDays		:int;
		/**
		 * 今天奖励金币数
		 */		
		public var coin				:int;
		/**
		 *本月签到标识组合
		 * 0 未签
		 * 1 已签
		 */		
		public var signDayTags		:Array = [];
		/**
		 *今天奖励 道具
		 */		
		public var todayAwards		:Array = [];
		/**
		 * 签到5天奖励是否领取
		 * (0,1,2)(不可领取，已领取,可领取)
		 */		
		public var is_get_day5		:int;
		/**
		 *  签到12天奖励是否领取
		 */		
		public var is_get_day12		:int;
		/**
		 *  签到26天奖励是否领取
		 */		
		public var is_get_day26 	:int;
		/**
		 *领取标识 
		 */		
		public var getDayFlags		:Array = [];
		/**
		 *4个领取级别奖励说明
		 * 0 每天
		 * 1 5天
		 * 2 12天
		 * 3 26天 
		 */		
		public var tips				:Array = ["","","",""]
		
		public function SignInfoVo()
		{
		}
		/**
		 * 获取补签 费用 
		 * @return 
		 * 
		 */		
		public function get resignRice():int
		{
			var temRice :int = Math.pow(2,reSignDays)*36;
			if(temRice > 99999)
			{
				temRice = 99999;
			}
			return temRice;
		}
		/**
		 *解析数据 
		 * @param obj
		 * 
		 */		
		public function parse(obj :Object):void
		{
			if(obj==null)return;
			var resObj :Object = obj;
			var days	:int = resObj.days;
			sign_days 		= 0;
			reSignDays		= resObj.fillcheck;
			is_get_today	= resObj.status1;
			is_get_day5 	= resObj.status2;
			is_get_day12 	= resObj.status3;
			is_get_day26 	= resObj.status4;
			getDayFlags = [is_get_day5,is_get_day12,is_get_day26];
			var item :Object;
			var signFlag :int ;
			var timeMills :Number = AppData.getInstance().time * 1000;
			var curDate :Date = new Date(timeMills);
			var todays :int = curDate.date;
			for(var i :int = 1;i<=days;i++)
			{
				signFlag = resObj["day"+i];
				if(signFlag != 0)
				{
					sign_days ++;
				}
				if(i <= todays)
				{
					signDayTags.push(signFlag);
				}
			}
			tips[0] = "欧元包*1\n随机道具*1\n";
			tips[1] = "随机道具包*1\n搜素卡*1\n随机属性卡包*1\n蓝色洗练卡*1\n蓝色球员卡*1";
			tips[2] = "紫色球员卡*1\n紫色洗练卡*1\n随机属性卡包*1\n保护膜*1\n超级搜素卡*1";
			tips[3] = "橙色球员卡*1\n幸运卡*1\n随机属性卡包*1\n超级搜素卡*1\n橙色洗练卡*1";
			
			is_sign = signDayTags[todays-1];
			if(is_sign!=0 && is_get_today == 0)
			{
				is_get_today = 2;
			}
			//test
			//continue_sign = 30;
			//getDayFlags = [1,1,1];
			//is_get_today = 1;
		}
	}
}